package com.company;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import lombok.Data;

import java.io.Serializable;

/**
 * @date : 2022-07-24 下午9:28
 * 基本类型和包装类型对比
 * 包装类型全为null,基本类型有默认值
 */

public class P023_BoxingType {

    public static void main(String[] args) throws JsonProcessingException {
        Model model = new Model();
        ObjectMapper objectMapper = new ObjectMapper();
        ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
        System.out.println(objectWriter.writeValueAsString(model));
    }

    @Data
    public static class Model implements Serializable {
        private Boolean success;
        private boolean failure;
        private Integer integer;
        private int i;
        private Long aLong;
        private long l;
        private Character character;
        private char c;
        private Short aShort;
        private short s;
        private Byte aByte;
        private byte b;
        private Float aFloat;
        private float f;
        private Double aDouble;
        private double d;
        private String string;
    }
}
